#include<algorithm>
#include<cmath>
#include<iostream>
#include<map>
#include<queue>
#include<set>
#include<string>
#include<vector>

using namespace std;

long long solve(long long mid)
{
	long long count = 0;
	for (long long i = 2; i * i * i <= mid; i++)
	{
		count += mid / (i * i * i);
	}
	return count;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.sync_with_stdio(false);
	cout.sync_with_stdio(false);
	long long times;
	cin >> times;
	long long left = 0;
	long long right = LLONG_MAX;
	while (left < right)
	{
		long long mid = (left + right) / 2;
		if (solve(mid) >= times)
		{
			right = mid;
		}
		else
		{
			left = mid + 1;
		}
	}
	if (solve(left) == times)
	{
		cout << left;
	}
	else
	{
		cout << -1;
	}
	return 0;
}